export default {
    // 判断是否为空
    isEmpty(value) {
        if (typeof value === "undefined" || value === null || (typeof value === "string" && value.trim() === "") || (Array.prototype.isPrototypeOf(value) && value.length === 0) || (Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0)) {
            return true;
        } else {
            return false;
        }
    },

    // 密码加密
    encrypt(plaintText) {
        let options = {
            mode: CryptoJS.mode.ECB,
            padding: CryptoJS.pad.Pkcs7
        };
        let key = CryptoJS.enc.Utf8.parse(constant.cryptojs_key);
        let encryptedData = CryptoJS.AES.encrypt(plaintText, key, options);
        return encryptedData.toString().replace(/\//g, "_").replace(/\+/g, "-");
    },
}